package org.example.bean.enums;

import lombok.Getter;

@Getter
public enum DateType {

    /**
     * 今日
     */
    TODAY(0, "今日"),
    /**
     * 昨日
     */
    YESTERDAY(1, "昨日"),
    /**
     * 本月
     */
    MONTH(2, "本月");

    private final Integer code;

    private final String description;

    DateType(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public static DateType ofCode(Integer code) {
        for (DateType type : DateType.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }
}
